home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1999 January / PC Plus Super CD No55a (PCP-147A-1-99) (Disc 1) (1998).iso / linux / developers / visualtcl / windows / vtcl / lib / menu.tcl < prev    next >
Encoding:
Text File  |  1998-02-01  |  5.2 KB  |  136 lines

  1. ##############################################################################
  2. # $Id: menu.tcl,v 1.4 1998/02/02 05:11:33 stewart Exp $
  3. #
  4. # menu.tcl - library of main app menu items
  5. #
  6. # Copyright (C) 1996-1997 Stewart Allen
  7. #
  8. # This program is free software; you can redistribute it and/or
  9. # modify it under the terms of the GNU General Public License
  10. # as published by the Free Software Foundation; either version 2
  11. # of the License, or (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. # GNU General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with this program; if not, write to the Free Software
  20. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  
  22. ##############################################################################
  23. #
  24.  
  25. set vTcl(menu,file) {
  26.     {New              Ctrl+N       vTcl:new                   }
  27.     {separator        {}           {}                         }
  28.     {Open             Ctrl+O       vTcl:open                  }
  29.     {Save             Ctrl+S       vTcl:save                  }
  30.     {{Save As...}     {}           vTcl:save_as               }
  31.     {Close            Ctrl+W       vTcl:close                 }
  32.     {separator        {}           {}                         }
  33.     {Source           {}           vTcl:file_source           }
  34.     {Preferences      {}           vTclWindow.vTcl.prefs      }
  35.     {separator        {}           {}                         }
  36.     {Quit             Ctrl+Q       vTcl:quit                  }
  37. }
  38.  
  39. set vTcl(menu,edit) {
  40.     {Undo             Ctrl+Z       vTcl:pop_action            }
  41.     {Redo             Ctrl+R       vTcl:redo_action           }
  42.     {separator        {}           {}                         }
  43.     {Cut              Ctrl+X       vTcl:cut                   }
  44.     {Copy             Ctrl+C       vTcl:copy                  }
  45.     {Paste            Ctrl+V       vTcl:paste                 }
  46.     {separator        {}           {}                         }
  47.     {Delete           {}           vTcl:delete                }
  48. }
  49.  
  50. set vTcl(menu,mode) {
  51.     {{Test Mode}      Alt+T        {vTcl:setup_unbind_tree .} }
  52.     {{Edit Mode}      Alt+E        {vTcl:setup_bind_tree .}   }
  53. }
  54.  
  55. set vTcl(menu,system) {
  56. }
  57.  
  58. set vTcl(menu,user) {
  59. }
  60.  
  61. set vTcl(menu,insert) {
  62.     {{System}         {menu system} {} }
  63.     {{User}           {menu user}   {} }
  64. }
  65.  
  66. set vTcl(menu,compound) {
  67.     {Create           Alt+C         {vTcl:name_compound $vTcl(w,widget)} }
  68.     {Insert           {menu insert} {}                         }
  69.     {separator        {}            {}                         }
  70.     {{Save Compounds} {}            vTcl:save_compounds        }
  71.     {{Load Compounds} {}            vTcl:load_compounds        }
  72.     {separator        {}            {}                         }
  73.     {{Save as Tclet}  {}            {vTcl:create_tclet $vTcl(w,widget)}  }
  74. }
  75.  
  76. set vTcl(menu,options) {
  77.     {{Set Insert}      Alt+I        vTcl:set_insert            }
  78.     {{Set Alias}       Alt+A        {vTcl:set_alias $vTcl(w,widget)}     }
  79.     {separator         {}           {}                         }
  80.     {{Select Toplevel} {}           vTcl:select_toplevel       }
  81.     {{Select Parent}   {}           vTcl:select_parent         }
  82.     {separator         {}           {}                         }
  83.     {Bindings          Alt+B        vTcl:show_bindings         }
  84.     {Properties        Alt+P        {vTcl:properties $vTcl(w,widget)}    }
  85.     {separator         {}           {}                         }
  86.     {Hide              {}           vTcl:hide                  }
  87. }
  88.  
  89. #    {Project             {}        vTcl:project:show          }
  90. set vTcl(menu,window) {
  91.     {{Attribute Editor}  {}         vTcl:show_propmgr          }
  92.     {{Function List}     {}         {vTcl:proclist:show 1}     }
  93.     {{Window List}       {}         {vTcl:toplist:show 1}      }
  94.     {separator           {}         {}                         }
  95.     {{Command Console}   {}         vTcl:show_console          }
  96.     {{Widget Tree}       Alt+W      vTcl:show_wtree            }
  97. }
  98.  
  99. set vTcl(menu,help) {
  100.     {{About Visual Tcl}  {}         vTclWindow.vTcl.about      }
  101.     {{Index of Help}     {}         vTclWindow.vTcl.help       }
  102. }
  103.  
  104. proc vTcl:menu:insert {menu name {root ""}} {
  105.     global vTcl tcl_version
  106.     if {$tcl_version >= 8} {
  107.         set tab ""
  108.     } else {
  109.         set tab "\t"
  110.     }
  111.     if {$root != ""} {
  112.         if {![winfo exists $root]} {
  113.             menu $root
  114.         }
  115.         $root add cascade -label [vTcl:upper_first $name] -menu $menu
  116.     }
  117.     menu $menu -tearoff 0
  118.     set vTcl(menu,$name,m) $menu
  119.     foreach item $vTcl(menu,$name) {
  120.         set txt [lindex $item 0]
  121.         set acc [lindex $item 1]
  122.         if {[llength $acc] > 1} {
  123.             vTcl:menu:insert $menu.[lindex $acc 1] [lindex $acc 1] $menu
  124.         } else {
  125.             set cmd [lindex $item 2]
  126.             if {$txt == "separator"} {
  127.                 $menu add separator
  128.             } else {
  129.                 $menu add command -label $txt$tab -accel $acc -command $cmd
  130.                 set vTcl(menu,$name,widget) $menu
  131.             }
  132.         }
  133.     }
  134. }
  135.  
  136.